package com.youi.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.youi.common.Common;
import com.youi.common.DelStatus;
import com.youi.dao.BankcodeDao;
import com.youi.entity.Bankcode;
import com.youi.service.BankcodeService;

@Service
public class BankcodeServiceImpl extends BaseServiceImpl<Bankcode> implements BankcodeService{
		
		private BankcodeDao bankcodeDao;
		
		@Autowired
		public void setfaultRecordDao(BankcodeDao bankcodeDao){
			this.bankcodeDao=bankcodeDao;
			super.setBaseDAO(bankcodeDao);
		}

		@Override
		public String getBankCodeByBank(String bank) {
			// TODO Auto-generated method stub
			Map<String, Object> prams=new HashMap<String, Object>();
			prams.put(Common.DELSTATUS, DelStatus.NODEL);
			prams.put("name", bank);
			Bankcode bankcode=bankcodeDao.getObject(prams);
			if (bankcode!=null) {
				return bankcode.getCode();
			}
			return null;
		}

		@Override
		public Bankcode getBankcodeByName(String bank) {
			// TODO Auto-generated method stub
			Map<String, Object> prams=new HashMap<String, Object>();
			prams.put(Common.DELSTATUS, DelStatus.NODEL);
			prams.put("name", bank);
			Bankcode bankcode=bankcodeDao.getObject(prams);
			if (bankcode!=null) {
				return bankcode;
			}
			return null;
		}
}